package com.zbj;

import com.zbj.enums.Season;
import com.zbj.enums.SeasonPattern;

/**
 * EnumMain
 *
 * @author weigang
 * @create 2019-07-31
 **/
public class EnumMain {
    public static void main(String[] args) {
        System.out.println("原始数据：");
        for (Season season : Season.values()) {
            System.out.println(season);
        }
        System.out.println("-----------------------------");
        // 即使枚举对象属性增加 也不用修改源码
        DynamicEnumUtils.addEnum(Season.class, "WINTER", new Class[]{
                java.lang.String.class, SeasonPattern.class}, new Object[]{
                "winter", SeasonPattern.SNOW});
        System.out.println("添加后的数据：");
        for (Season season : Season.values()) {
            System.out.println(season);
        }
        System.out.println("-----------------------------");
        Season season = Season.valueOf("WINTER");
        System.out.println("新添加的枚举类型可以正常使用：");
        System.out.println(season.name());
        System.out.println(season.getKey());
        System.out.println(season.getSeasonPattern());
    }
}